#define _CRT_SECURE_NO_WARNINGS
#include<vector>
#include <iostream>
using namespace std;

int main()
{
	int m, n;
	cin >> n >> m;
	vector<vector<int>> vv(n + 1, vector<int>(m + 1, 0));
	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < m; j++)
		{
			if (i == 0 && j < m || j == 0 && i < n)
			{
				vv[i][j] = 1;
			}
			else if (i > 0 && i < n && j > 0 && j < m)
			{
				vv[i][j] = 2;
			}
		}
	}
	vv[0][0] = 2;
	int count = 0;
	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < m; j++)
		{
			count += vv[i][j];
		}
	}
	cout << count;
	return 0;
}
 